package com.huabo.controller.base;

import java.util.HashMap;
import java.util.Map;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.ServletRequestUtils;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.ResponseBody;

import com.huabo.base.BaseController;
import com.huabo.model.OperationLog;
import com.huabo.service.inter.OperationLogService;
import com.huabo.utils.Page;
import com.huabo.utils.Response;
import com.huabo.utils.ResponseUtils;

@Controller
public class OperationLogController extends BaseController {

    @Autowired
    private OperationLogService operationLogService;

    /**
     * 分页查询通用操作日志
     *
     * @param request
     * @param response
     * @return
     */
    @RequestMapping(value = "/web/operationLog/list", method = {RequestMethod.POST, RequestMethod.GET})
    @ResponseBody
    public Response list(HttpServletRequest request, HttpServletResponse response) {
        Map<String, Object> params = new HashMap<String, Object>();
        initParams(params, request);
        String searchInput = ServletRequestUtils.getStringParameter(request, "searchInput", null);
        params.put("searchInput", searchInput);
        Page<OperationLog> page = operationLogService.queryPage(params);

		return ResponseUtils.success(page);
    }
}
